{% extends "dashboard.html" %}

{% block content %}

    <h1 class="page-header">主要分类
        <small><a href="{% url 'category_add'%}">新增</a></small>
    </h1>

    <div class="table-responsive">
        <table class="table table-striped">
            <thead>
                <tr>
                    <th>#</th>
                    <th>ID</th>
                    <th>主要分类名</th>
                    <th>编辑 | 删除</th>
                </tr>
            </thead>


            <tbody>
                {% for category in categories %}
                    <tr>
                        <td>{{ forloop.counter }}</td>
                        <td>{{ category.pk }}</td>
                        <td>{{ category.title }}</td>
                        <td>
                            <a class="btn btn-sm btn-primary" href="{% url 'category_edit' category.pk %}">编辑</a>
                            <a class="btn btn-sm btn-danger" href="{% url 'category_delete' category.pk %}">删除</a>
                        </td>
                    </tr>
                {% endfor %}
            </tbody>



        </table>


    </div>

{% endblock content %}
